package com.own.business.message.center.controller.user.entity.query;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;

/**
 * NextLatestQuery
 *
 * @author chenxueli
 * @date 2023-11-13 19:36:00
 */
@Data
public class NextLatestQuery implements Serializable {

    @Schema(title = "时间戳")
    private Long timestamp;

    @Schema(title = "限制条数")
    private Integer limit;

    public void check() {
        init();
        if (timestamp == null) {
            throw new IllegalArgumentException("timestamp不能为空");
        }
    }

    public void init() {
        if (limit == null) {
            limit = 500;
        }
    }

}
